package org.jprogger.myworld.api.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jprogger.myworld.api.ApiServiceInvocationException;
import org.jprogger.myworld.api.app.AppContext;
import org.jprogger.myworld.api.model.Photo;
import org.jprogger.myworld.api.model.PhotoAlbum;
import org.jprogger.myworld.api.response.ApiResponse;
import org.jprogger.myworld.api.response.handler.GetListPhotoAlbumApiResponseHandler;
import org.jprogger.myworld.api.response.handler.GetListPhotoApiResponseHandler;

public class PhotoService extends BaseApiService {

	public PhotoService(AppContext context) {
		super(context);
	}
	
	public ApiResponse<List<Photo>> getPhotos(String userId, int albumId, Integer[] photoIds) 
			throws ApiServiceInvocationException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", userId);
		params.put("aid", albumId);
		params.put("pids", photoIds);
		params.put("method", "photos.get");
		return apiCall(params, new GetListPhotoApiResponseHandler());
	}
	
	public ApiResponse<List<PhotoAlbum>> getPhotoAlbums(Integer userId, Integer[] albumIds)
			throws ApiServiceInvocationException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", userId);
		params.put("aids", albumIds);
		params.put("method", "photos.getAlbums");
		return apiCall(params, new GetListPhotoAlbumApiResponseHandler());
	}
}
